<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 调试代码 开发的时候常写，上线前应该删除
        // 瞬间执行完的代码
        // event loop 的一个单元
        // console.log('start');
        // setTimeout(() => {
        //     console.log('timeout');
        // }, 0)

        // // resolve静态方法
        // Promise.resolve().then(() => {
        //     console.log('resolve');
        // });
        // Promise.resolve().then(() => {
        //     console.log('resolve2');
        // });
        // const p = new Promise((resolve, reject) => {
        //     console.log('p promise inatance');
        //     setTimeout(() => {
        //         console.log('++++++');
        //         resolve('dddddd')
        //     }, 100)
        // })
        // console.log('end');


        Promise.resolve().then(() => {
            console.log('Promise1');
            setTimeout(() => {
                console.log('setTimeout2');
            }, 0)
        });

        setTimeout(() => {
            console.log('setTimeout1');
            Promise.resolve().then(() => {
                console.log('Promise2');
            })
        }, 0);
        console.log('start');
    </script>
</body>

</html>